#include <b64/cencode.h>
#include <stdio.h>
#include <string.h>


//testing base64 encoding and decoding fuctions.
//

int main(void) 
{
	base64_encodestate state_in;
	base64_init_encodestate(&state_in);
	printf("base64_encodestep : %d\n"
			"result : %c\n"
			"stepcount : %d\n",
			state_in.step,
			state_in.result,
			state_in.stepcount);

	printf("\n\n");

	//convert 'a' to base64 'a'.
	char value_in = 'a';
	printf("convert 'a' to base64 char :\n"
			"%c : %c",
			value_in,
			base64_encode_value(value_in));

	printf("\n\n");


	//convert 'string a and b' to base64.
	char *string_in = "string a and b";
	char strout[256] = {0,};
	base64_encode_block(string_in, strlen(string_in),
			(char *)strout,
			&state_in);

	printf("convert the \"%s\" to \"%s\".\n", string_in, (char *)strout);
	printf("the state after converting the %s:\n", string_in);
	printf("base64_encodestep : %d\n"
			"result : %c\n"
			"stepcount : %d\n",
			state_in.step,
			state_in.result,
			state_in.stepcount);


}
